// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import * as echarts from 'echarts'

Vue.config.productionTip = false

import {
    Button,
    Message,
    Menu,
    MenuItem,
    Submenu,
    Form,
    FormItem,
    Input,
    Container,
    Aside,
    Main,
    Header,
    Breadcrumb,
    BreadcrumbItem,
    Card,
    Row,
    Col,
    Select,
    Option,
    Table,
    TableColumn,
    Pagination,
    DatePicker,
    Switch,
    Checkbox
} from 'element-ui'

Vue.use(Checkbox)
Vue.use(Switch)
Vue.use(DatePicker)
Vue.use(Pagination)
Vue.use(TableColumn)
Vue.use(Table)
Vue.use(Row)
Vue.use(Col)
Vue.use(Select)
Vue.use(Option)
Vue.use(Card)
Vue.use(BreadcrumbItem)
Vue.use(Breadcrumb)
Vue.use(Header)
Vue.use(Main)
Vue.use(Aside)
Vue.use(Container)
Vue.use(Input)
Vue.use(FormItem)
Vue.use(Form)
Vue.use(Submenu)
Vue.use(MenuItem)
Vue.use(Menu)
Vue.use(Button)

Vue.prototype.$message = Message
Vue.prototype.$echarts = echarts

// 配置axios的请求根地址
// axios.defaults.baseURL = 'http://47.122.1.54:9010/api/'
axios.defaults.baseURL = 'http://127.0.0.1:8000/api/'

Vue.prototype.$http = axios

axios.interceptors.request.use(config => {
    config.headers.Authorization = window.sessionStorage.getItem('token')
    return config
})

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    components: { App },
    template: '<App/>'
})